cmake_minimum_required(VERSION 3.10)
project(SampleCppProject)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

# Core library
add_library(core_lib
    core/processor.cpp
)

# Utils library
add_library(utils_lib
    utils/helpers.cpp
)

# API library
add_library(api_lib
    api/client.cpp
)

# Main executable
add_executable(sample_app
    main.cpp
)

# Link libraries
target_link_libraries(sample_app
    core_lib
    utils_lib
    api_lib
)

# Find and link filesystem library if needed
find_library(FILESYSTEM_LIB stdc++fs)
if(FILESYSTEM_LIB)
    target_link_libraries(utils_lib ${FILESYSTEM_LIB})
endif()

# Installation
install(TARGETS sample_app DESTINATION bin)
install(TARGETS core_lib utils_lib api_lib DESTINATION lib)
install(FILES core/processor.h utils/helpers.h api/client.h DESTINATION include)